package com.xjprojectc.webservice;


import java.io.File;

import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class UploadTest {
	public static void main(String[] args) throws Exception {
		
		 String url = "http://222.80.103.52:8089/XJPROJECT/services/FileAlternately?wsdl";
		 MyFile resume = new MyFile();
		 resume.setCandidateName("tt");
		 resume.setResumeFileType("jpg");
		 DataSource source = new FileDataSource(new File("d:\\tt.jpg"));
		 resume.setResume(new DataHandler(source));	

		 JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		 
		 factory.setServiceClass(IFileAlternatelyService.class);
		 factory.setAddress(url);
		 IFileAlternately client = (IFileAlternately) factory.create();
		 try {
			 client.uploadFile(resume);
		} catch (Exception e) {
			System.out.println("sa");
		}		 
		 
		 System.out.println("success");
	}

}